package com.zrrd.threadPriority;

import java.util.concurrent.ExecutionException;
import java.util.concurrent.FutureTask;

/**
 * @author WanJl
 * @version 1.0
 * @title MyCallableDemo
 * @description
 * @create 2024/6/16
 */
public class MyCallableDemo {
    public static void main(String[] args) throws ExecutionException, InterruptedException {
        MyCallable mc = new MyCallable();
        FutureTask<Integer> future=new FutureTask<>(mc);
        Thread t=new Thread(future,"线程1");
        t.setPriority(10);

        MyCallable mc1 = new MyCallable();
        FutureTask<Integer> future1=new FutureTask<>(mc1);
        Thread t1=new Thread(future1,"线程2");
        t1.setPriority(1);
        //获取此线程的优先级
        t1.getPriority();
        t.start();
        t1.start();

    }
}
